package com.kmb.commons.log;

import com.kmb.commons.log.aspect.SysLogAspect;
import com.kmb.commons.log.event.SysLogListener;
import com.kmb.provider.api.LogService;
import lombok.AllArgsConstructor;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;

/**
 * @date 2019/2/1
 * 日志自动配置
 */
@EnableAsync
@Configuration
@AllArgsConstructor
@ConditionalOnWebApplication
//@EnableFeignClients({"com.kmb.business.user.feign"})
public class LogAutoConfiguration {


    @Reference(version = "1.0.0")
    private LogService echoService;

    @Bean
    public SysLogListener sysLogListener() {
        return new SysLogListener(echoService);
    }

    @Bean
    public SysLogAspect sysLogAspect() {
        return new SysLogAspect();
    }
}
